import java.io.Serializable;
import java.util.*;

public class CompteEpargne extends CompteBancaire implements Serializable {

	private static final long serialVersionUID = 8720875756950015747L;

	private long m_numero;
	private float m_taux=0f;
	private Banque m_banque;

	public CompteEpargne(final Banque ban, final Titulaire titulaire, final float tauxRemuneration) {

		super(ban, titulaire);
		m_numero = ban.numeroRegistreCptE();
		m_taux = tauxRemuneration;
		m_banque= ban;
	}

	public long getNumeroCompte() {
		return m_numero;
	}

	protected void sub(float montant) {

		if(montant < 200.0f)
			super.sub(montant * 1.008f);
		else
			super.sub(montant);
	}

	public float executer(OperationBancaire op) {

		if(op.getType() == 'R')
			sub(op.getMontant());

		if(op.getType() == 'V' || op.getType() == 'I')
			add(op.getMontant());

		m_pOperation.put(op.getNumero(), op);

		return getSoldeCompte();
	}

	public float executer(String intitule, char type, float montant) {

		return executer(new OperationBancaire(m_banque, type, intitule, montant));
	}
}
